function $(str) {
    return document.getElementById(str);
}

function eSetSort(e) {
    if(!e) e = window.event;

    var tgt = e.target ? e.target : e.srcElement;
    var key = tgt.id;
    switch(key)
    {
        case "lktitle":
        case "lkauthor":
        case "lklang":
        case "lkprojid":
        case "lkgenre":
        case "lkpm":
        case "lkdiff":
        case "lkround":
            break;
        default:
            return;
    }
    var vsort = $("sort");
    var vdesc = $("desc");

    if( vsort.value === key ) 
    {
        vdesc.value = (vdesc.value == '0') ? '1' : '0' ;
    }
    else 
    {
        vsort.value = key ;
        vdesc.value = '0' ;
    }
    var sf = $('searchform');
    sf.submit();
}
